package cn.piesat.scanning.utils;

import org.springframework.stereotype.Component;

import java.util.ResourceBundle;

/**
 * 读取config.properties文件工具类
 * @author Administrator
 * 
 */
@Component
public class ConfigPropertiesUtil {
	private static ResourceBundle resourceBundle = null;
	
	/**
	 * 读取配置文件的键值对
	 * @param keyName 键 
	 * @return
	 */
	public static String get(String fileName,String keyName) {
		resourceBundle = ResourceBundle.getBundle(fileName);
		String keyValue = "";
		try {
			keyValue = new String(resourceBundle.getString(keyName).getBytes("ISO-8859-1"), "UTF-8");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return keyValue;
	}
}
